package com.wuxiaofan.coupon.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.coupon.entity.SmsCouponSpuRelation;
import com.wuxiaofan.coupon.entity.custom.SmsCouponSpuRelationCustom;
import com.wuxiaofan.coupon.mapper.SmsCouponSpuRelationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.coupon.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class SmsCouponSpuRelationService {
    @Autowired
    private SmsCouponSpuRelationMapper smsCouponSpuRelationMapper;
    @Resource
    private Idgenerator idgenerator;
    public SmsCouponSpuRelation findById(String id){
        return smsCouponSpuRelationMapper.selectById(id);
    }

    public SmsCouponSpuRelationCustom findCountByMap(Map paraMap){
        return smsCouponSpuRelationMapper.findCountByMap(paraMap);
    }

    public SmsCouponSpuRelationCustom findGroupByMap(Map paraMap){
        return smsCouponSpuRelationMapper.findGroupByMap(paraMap);
    }

    public List<SmsCouponSpuRelationCustom> findByMap(Map paraMap){
        return smsCouponSpuRelationMapper.findByMap(paraMap);
    }

    public Page<SmsCouponSpuRelationCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(smsCouponSpuRelationMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        smsCouponSpuRelationMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        smsCouponSpuRelationMapper.deleteById(id);
    }

    public SmsCouponSpuRelation save(SmsCouponSpuRelation smsCouponSpuRelation){
        smsCouponSpuRelation.setId(idgenerator.getId());
        smsCouponSpuRelationMapper.insert(smsCouponSpuRelation);
        return smsCouponSpuRelation;
    }

}
